<?php
namespace app\index\model;

use think\Model;
use think\DB;

class Feedback extends Model
{
    public function putFeedbackContent($contents,$uid){
        //反馈时间必须超过180s
        $last_feedback_time = DB::name('feedback')->where('uid',$uid)->order('id desc')->find();
        if(time() - $last_feedback_time['time'] <= 180){
            return 0;
        }
        $map = [
            'uid' => $uid,
            'contents' => $contents,
            'time' => time(),
        ];
        return $this->data($map)->save();
    }
}